package org.mcflier.appuntamento.data.model;

public class TorrentCategory {		
	public static final TorrentCategory HD_CATEGORY = new TorrentCategory(1, "HD");
	public static final TorrentCategory SD_CATEGORY = new TorrentCategory(2, "SD");
	public static final TorrentCategory UNDEFINED_CATEGORY = new TorrentCategory(3, "Undefined");

	private int id;
	private String name;

	public TorrentCategory(int id, String name){
		if(name==null)
			throw new NullPointerException("Name must not be null");
		if(id<1 || id>3)
			throw new IllegalArgumentException("The category id is invalid. 1 for HD, 2 for SD, 3 for undefined");

		this.id = id;
		this.name = name;
	}

	public int getId(){
		return this.id;	
	}

	public String getName(){
		return this.name;
	}

	@Override
	public boolean equals(Object arg) {
		return ((TorrentCategory)arg).getId()==this.id;
	}

	public String toString(){
		return this.getName();
	}
}